# -*- coding:UTF-8 -*-
import openpyxl


# 从hunan_figure.xlsx中获取所有的人物姓名
def get_all_figure_names():
    wb = openpyxl.load_workbook('hunan_figure.xlsx')
    # 获取所有工作表名
    names = wb.sheetnames
    # 使用wb[name] 获取指定工作表
    sheet = wb[names[0]]
    figure = {}
    # 获取所有的行
    for one_row_data in sheet.iter_cols():
        title = ''
        figure_names = []
        for index in range(len(one_row_data)):
            if index == 0:
                title = one_row_data[0].value
                continue
            if not one_row_data[index].value is None:
                value = one_row_data[index].value
                figure_names.append(value)
        figure[title] = figure_names

    titles = figure.keys()
    all_data = []
    for item in titles:
        all_data.extend(figure[item])
    return all_data

